package com.rabbitmq.provider.config.elasticsearch;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.UnknownHostException;

/**
 * @author wangdong
 * @data 2020/03/27 0027 14:19
 * @DAY 星期五
 * @描述 es
 */
@Configuration
@ConfigurationProperties(prefix = "elasticsearch")
public class ESConfig {

    @Bean
    public RestHighLevelClient client() {

        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("127.0.0.1", 9200, "http")));

        return client;
    }
}
